package a.e;

import a.c.v;
import a.c.z;
import a.e.a.*;
import a.e.a.j;
import a.e.a.l;
import a.i.n;

import java.awt.*;
import java.io.*;
import java.net.URL;

public class f
  extends e
{
  private static ib c;
  private static a.e.a.f d;
  private static final z e = new z();
  private static final int f = 32;
  public static boolean g;
  
  public String a()
  {
    return "GML Format";
  }
  
  public String b()
  {
    return "gml";
  }
  
  public void a(a.j.g paramg, InputStream paramInputStream)
    throws IOException
  {
    paramg.z();
    try
    {
      a(paramg, new InputStreamReader(paramInputStream));
    }
    finally
    {
      paramg.A();
    }
  }
  
  public void b(a.j.g paramg, String paramString)
    throws IOException
  {
    paramg.z();
    try
    {
      c(paramg, paramString);
    }
    finally
    {
      paramg.A();
    }
  }
  
  private void c(a.j.g paramg, String paramString)
    throws IOException
  {
    URL localURL = paramg.cb();
    paramg.a(new File(paramString).toURL());
    FileReader localFileReader = new FileReader(paramString);
    try
    {
      a(paramg, localFileReader);
    }
    catch (IOException localIOException)
    {
      paramg.a(localURL);
      throw localIOException;
    }
    finally
    {
      localFileReader.close();
    }
  }
  
  protected void a(a.j.g paramg, Reader paramReader)
    throws IOException
  {
    j.a_ locala_ = f().a(paramg);
    j localj = new j(locala_);
    localj.a(paramReader);
  }
  
  public static synchronized ib f()
  {
    if (e.b == 0) {
      if (c == null) {
        c = new b();
      }
    }
    return c;
  }
  
  public static synchronized void a(ib paramib)
  {
    c = paramib;
  }
  
  public static synchronized a.e.a.f g()
  {
    if (e.b == 0) {
      if (d == null) {
        d = new l();
      }
    }
    return d;
  }
  
  public static synchronized void a(a.e.a.f paramf)
  {
    d = paramf;
  }
  
  public void a(a.j.g paramg, OutputStream paramOutputStream)
    throws IOException
  {
    PrintWriter localPrintWriter = new PrintWriter(paramOutputStream);
    a.e.a.g localg = new a.e.a.g(localPrintWriter);
    a.e.a.f localf = g();
    hb localhb = localf.a();
    n.a(this, "saving in gml format....");
    localhb.a(paramg, localg);
    localPrintWriter.flush();
  }
  
  public static String a(Color paramColor)
  {
    int k = e.b;
    int j = e.a;
    StringBuffer localStringBuffer = new StringBuffer(9);
    localStringBuffer.append('#');
    String str = Integer.toHexString(paramColor.getRed()).toUpperCase();
    int i = 2 - str.length();
    do
    {
      if (i <= 0) {
        break;
      }
      localStringBuffer.append('0');
      i--;
      if (k != 0) {
        break label102;
      }
      if (j != 0) {
        break label96;
      }
    } while (j == 0);
    localStringBuffer.append(str);
    if (k == 0)
    {
      str = Integer.toHexString(paramColor.getGreen()).toUpperCase();
      label96:
      label102:
      i = 2 - str.length();
      do
      {
        if (i <= 0) {
          break;
        }
        localStringBuffer.append('0');
        i--;
        if (k != 0) {
          break label160;
        }
        if (j != 0) {
          break label154;
        }
      } while (j == 0);
      localStringBuffer.append(str);
    }
    if (k == 0)
    {
      str = Integer.toHexString(paramColor.getBlue()).toUpperCase();
      label154:
      label160:
      i = 2 - str.length();
      if (i > 0) {}
      while (k != 0)
      {
        localStringBuffer.append('0');
        i--;
        if (k != 0) {
          break label205;
        }
        if (j != 0) {
          break label201;
        }
        if (j == 0) {
          break;
        }
      }
      localStringBuffer.append(str);
      label201:
      label205:
      if (k == 0)
      {
        if (paramColor.getAlpha() != 255) {
          str = Integer.toHexString(paramColor.getAlpha()).toUpperCase();
        }
      }
      else
      {
        i = 2 - str.length();
        if (i > 0) {}
        for (;;)
        {
          if (k == 0)
          {
            localStringBuffer.append('0');
            i--;
            if (j == 0)
            {
              if (j == 0) {
                break;
              }
              if (k != 0) {
                continue;
              }
              localStringBuffer.append(str);
            }
          }
        }
      }
    }
    return localStringBuffer.toString();
  }
  
  public static Color c(String paramString)
  {
    int m = e.b;
    int k = e.a;
    synchronized (e)
    {
      if ((m != 0) || (paramString.length() >= 1))
      {
        if (m != 0) {
          break label61;
        }
        if (paramString.charAt(0) == '#') {}
      }
      else
      {
        return Color.black;
      }
      if (m == 0) {
        if (paramString.length() > 7)
        {
          label61:
          i = Integer.parseInt(paramString.substring(1, 7), 16);
          j = Integer.parseInt(paramString.substring(7), 16);
          i += ((j & 0xFF) << 24);
          if (m != 0) {
            break label125;
          }
          if (k == 0) {
            break label126;
          }
        }
      }
      int j = Integer.parseInt(paramString.substring(1), 16);
      label125:
      int i = j + -16777216;
      label126:
      Object localObject1 = e.f();
      Object localObject2;
      do
      {
        if (localObject1 == null) {
          break;
        }
        localObject2 = (Color)((v)localObject1).c();
        if (k != 0) {
          break label204;
        }
        if (m == 0)
        {
          if (((Color)localObject2).getRGB() == i)
          {
            e.h((v)localObject1);
            e.b((v)localObject1);
            return localObject2;
          }
          localObject1 = ((v)localObject1).a();
        }
      } while (k == 0);
      label204:
      localObject1 = new Color(i, true);
      if (m == 0) {
        if (e.size() >= 32)
        {
          localObject2 = e.g();
          e.h((v)localObject2);
          ((v)localObject2).a(localObject1);
          if (m != 0) {
            break label265;
          }
          e.b((v)localObject2);
          if (k == 0) {
            break label270;
          }
        }
      }
      label265:
      e.a(localObject1);
      label270:
      return localObject1;
    }
  }
  
  static
  {
    e.add(Color.black);
    e.add(Color.red);
    e.add(Color.blue);
    e.add(Color.yellow);
    e.add(Color.green);
    e.add(Color.white);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.e.f

 * JD-Core Version:    0.7.0.1

 */